import { View } from "@tarojs/components";
import React from "react";
import { Panel } from "../../../components/Panel";
import { INews } from "../../../types";
import "../newsSection.scss";
export interface NewsSectionProps {
  title: string;
  subTitle: string;
  list: INews[];
  onClick?: (item: any) => void;
}

export const NewsSection = ({
  title,
  subTitle,
  list,
  onClick,
}: NewsSectionProps) => {
  return (
    <>
      <View className="section">
        <View className="panel">
          <View className="at-row at-row__align--center">
            <View className="at-col at-col-9">
              <View className="mainTitle">{title}</View>
              <View className="subTitle">{subTitle}</View>
            </View>
            <View className="at-col at-col-3">
              <View className="more">查看更多</View>
            </View>
          </View>
        </View>
        <View className="list">
          {list.map((item) => (
            <Panel key={item.id} data={item} onClick={onClick} />
          ))}
        </View>
      </View>
    </>
  );
};
